package reduce.fz.com.reduce.fragment;


import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.List;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.adapter.BaseListAdapter;
import reduce.fz.com.reduce.adapter.BaseRecycleViewHolder;
import reduce.fz.com.reduce.bean.Follow;
import reduce.fz.com.reduce.bean.User;
import reduce.fz.com.reduce.bean.result.UserWitness;
import reduce.fz.com.reduce.custom.FollowView;
import reduce.fz.com.reduce.fragment.base.BaseListFragment;

/**
 * A simple {@link Fragment} subclass.
 */
public class FensiNotifyFragment extends BaseListFragment<FensiNotifyFragment.MyViewHolder, User> {
    private String requesturl;
    private Long uid;

    public static FensiNotifyFragment create(Long uid) {
        Bundle bundle = new Bundle();
        if(uid!=null)
        bundle.putLong("uid", uid);
        FensiNotifyFragment fragment = new FensiNotifyFragment();
        fragment.setArguments(bundle);
        return fragment;

    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view= super.onCreateView(inflater, container, savedInstanceState);
        uid=getArguments().getLong("uid");
        return view;
    }

    public FensiNotifyFragment() {
    }

    @Override
    public MyViewHolder createItemViewHolder(ViewGroup parent) {
        View view = layoutInflater.inflate(R.layout.fensi_notify_item, parent,false);
        return new MyViewHolder(view);
    }

    @Override
    public MyViewHolder createfootViewHolder(View view) {
        return new MyViewHolder(view);
    }


    @Override
    public String createReqUrl() {
        return requesturl;
    }
    public   static class MyViewHolder extends BaseRecycleViewHolder<User> {
        private ImageView user_header;
        private TextView tv_user_nickname;
        private FollowView user_follow;

        public MyViewHolder(View itemView) {
            super(itemView);
            user_header = (ImageView) itemView.findViewById(R.id.user_header);
            tv_user_nickname = (TextView) itemView.findViewById(R.id.tv_user_nickname);
        }

        @Override
        public void renderView(User data,int position) {
            //Picasso.with(context).load(data.user.getHeadurl());
            Picasso.with(context).load(R.drawable.shuaige).into(user_header);
            //tv_user_nickname.setText(data.user.getNickname());
            //tv_pub_time.setText(data.pubTime + "");
            //Picasso.with(context).load(data.user.getHeadurl());
        }
    }

    public void request(String url) {
        List<User> list=new ArrayList<User>();
        for(int i=0;i<6;i++)
        {
            list.add(new User());
        }
        baseListAdapter.addDatas(list);


    }



}
